﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpModelInterface.h"
#include "GbmpQuickCast.h"
#include "IElement.h"


namespace gcmp
{
    class IDocument;
    class IModelView;


    /// \brief 参照视图设置类型
    enum class ShadowViewConfigType : int32_t
    {
        AccordingToHostView = 0,                ///< 按主体视图
        AccordingToReferenceView = 1           ///< 按参照视图
    };

    // \brief 影子视图
    class GCMP_MODEL_INTERFACE_EXPORT IShadowModelView : public IElement
    {
        DEFINE_CAST_DERIVED(gcmp::IShadowModelView, gcmp::IElement);

    public:
        virtual ~IShadowModelView() = default;

        /// \brief 创建参照视图代理对象
        ///
        /// \param pDocument 文档指针
        /// \param refModelViewId 参照视图对象Id
        /// \param hostModelViewId 主体视图Id
        /// \return IShadowModelView* 创建好的影子视图
        static IShadowModelView* Create(IDocument* pDocument, const ElementId& refModelViewId, const ElementId& hostModelViewId);


        // \brief 获取影子视图对象
        ///
        /// \param pHostModelView 主视图对象
        /// \param datasetId  参照的工作单元id
        /// \return IShadowModelView* 影子视图
        static IShadowModelView* GetShadowModelView(const IDocument* pDocument, const ElementId& hostModelViewId, const std::wstring& referenceDatasetId);

    public:       
        /// \brief 获取关联的主体视图对象Id
        /// \return 关联的主体视图对象Id
        virtual ElementId GetHostModelViewId() const = 0;

        /// \brief 获取文档中与之对应的参照视图对象的Id
        /// \return 对应的视图对象的Id
        virtual ElementId GetReferenceModelViewId() const = 0;

        /// \brief 设置文档中与之对应的参照视图对象的Id
        /// \param referenceModelViewId 对应的参照视图对象的Id
        /// \return bool 设置是否成功，true设置成功；false设置不成功
        virtual bool SetReferenceModelViewId(const ElementId& referenceModelViewId) = 0;

        /// \brief 获取对应的参照视图对象
        /// \return IShadowModelView* 参照视图对象
        virtual const IModelView* GetReferenceModelView() const = 0;

        /// \brief 获取对应的参照视图对象
        /// \return IShadowModelView* 参照视图对象
        virtual IModelView* GetReferenceModelView() = 0;

        /// \brief 获取对应的参照视图对象的所属工作单元
        /// \return std::wstring 参照视图对象所属工作单元
        virtual std::wstring GetOwnerDatasetIdOfReferenceModelView() const = 0;
    public:

        /// \brief 获取影子视图范围类型
        /// \return 对应的影子范围类型
        virtual ShadowViewConfigType GetShadowViewRangeType() const = 0;

        /// \brief 设置影子视图范围类型
        /// \param type 对应的影子视图范围类型
        virtual void SetShadowViewRangeType(ShadowViewConfigType type) = 0;

        /// \brief 获取影子视图样式类型
        /// \return 对应的影子视图样式类型
        virtual ShadowViewConfigType GetShadowViewGraphicsStyleType() const = 0;

        /// \brief 设置影子视图样式类型
        /// \param type 对应的影子视图样式类型
        virtual void SetShadowViewGraphicsStyleType(ShadowViewConfigType type) = 0;

        /// \brief 获取影子视图详细程度类型
        /// \return 对应的影子视图详细程度类型
        virtual ShadowViewConfigType GetShadowViewDetailLevelType() const = 0;

        /// \brief 设置影子视图详细程度类型
        /// \param type 对应的影子视图详细程度类型
        virtual void SetShadowViewDetailLevelType(ShadowViewConfigType type) = 0;

    public:
        /// \brief 获取Implementation Uid
        ///
        /// \return UniIdentity 返回ImplementationUid
        static const UniIdentity& GetImplementationUid();
    };
}
